package com;

import java.util.concurrent.TimeUnit;

import javax.annotation.PostConstruct;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import lombok.Data;

/**
 * Created by lzx on 16/7/26.
 */
@Controller
@Data
@Configuration
@ConfigurationProperties(prefix = "outer")
public class HomeController {


    private String url;

    @PostConstruct
    private void test() {
        System.out.println(url);
    }

    @RequestMapping(value = "/")
    public String home() {
        return "home";
    }

    @ResponseBody
    @RequestMapping(value = "/test", method = RequestMethod.GET)
    public String get() throws InterruptedException {
        System.err.println(Thread.currentThread());
        TimeUnit.SECONDS.sleep(8);
        return "hello world";
    }


    @ResponseBody
    @RequestMapping(value = "/student", method = RequestMethod.GET)
    public Object string() {
        return null;
    }

    @Data
    public static class Student {
        private String username;
        private int age;
    }


}
